function y = harkerp2(x)
% HARKERP2 function
% x0 = [1,2,...,n];
tp1=0;tp2=0;tp3=0;y=0;
n = length(x);
for i=1:n
    tp1=tp1+x(i);
    tp2=tp2+(x(i)+0.5*x(i)^2);
end

for j=2:n
    tp=0;
    for i=j:n
        tp=tp+x(i);
    end
    tp3=tp3+tp^2;
end
y=y+tp1^2-tp2+2*tp3;


